package com.lswms.modules.lswms.controller.statistics;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lswms.common.constant.Constant;
import com.lswms.common.page.PageData;
import com.lswms.common.utils.Result;
import com.lswms.modules.lswms.service.statistics.StatisticsService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

@RestController
@RequestMapping("lswms/statistics")
@Api(tags="statistics")
public class StatisticsController {
	@Autowired
	StatisticsService statisticsService; 
	
	@GetMapping("getEarlyWarning")
	public Result getEarlyWarning(@ApiIgnore @RequestParam Map<String, Object> params) {
		List<Map<String, Object>> page = statisticsService.getEarlyWarning(params);
		
		return new Result().ok(page);
	}
	
	
	@GetMapping("getSafetyStock")
	public Result getSafetyStock(@ApiIgnore @RequestParam Map<String, Object> params) {
		List<Map<String, Object>> page = statisticsService.getSafetyStock(params);
		
		return new Result().ok(page);
	}
	
	@GetMapping("getRecipientReport")
	public Result getRecipientReport(@ApiIgnore HttpServletRequest request) throws Exception {
		List<Map<String, Object>> page = statisticsService.getRecipientReport(request);
		
		return new Result().ok(page);
	}
}
